#!/usr/bin/env python
# encoding: utf-8

import codecs
import os

def main(env):
	basePath = os.path.expanduser(env["prefs"]["cwImport_defaultDirectory"])
	completePath = os.path.join(basePath,env["context"]["selection"].rstrip())
	text = codecs.open(completePath,"r",env["prefs"]["cwImport_defaultEncoding"]).read()
	label = env["static"]["cwImport_label"] % completePath
	return [("textBox",{"text":text,"label":label})]
